home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / 第1特集Plug-in / Photoshop / LYNXX Plug-In Folder.sit / LYNXX Plug-In Folder / ReadMe < prev    next >
Text File  |  1993-10-24  |  4KB  |  57 lines

  1. This plug-in shows just how easy it is to use the Photoshop plug-in interface now
  2. available to Image users. I have taken the example provided by Adobe and have
  3. removed some unneccessary code and added my own. There is nothing here for experienced programmers, rather this is an example of how a casual or beginning MAC programmer can get something useful done while learning about the Macintosh. The complete Think-C 5.04  project is here with all code and resources.  
  4.    
  5. Before proceeding one should read the documentation in the Plug-In Developers
  6. Kit available from Zippy. Especially if you want to work with very large images and
  7. spool them in a little at a time. 
  8.  
  9. This plug-in aquires an image from a file from a Lynxx CCD camera. This camera saves 12-bit images, ( that have been transferred from a DOS disk) packed in the following format: 00000000 XXXX0000 XXXXXXXX.  Three bytes for two pixels, where the first byte is the lsb's of the first pixel, the third byte is the lsb's of the second pixel, and
  10. the middle byte contains the msb's as shown.  This plug-in unscrambles the data
  11. and passes the information on to the calling application as an 8-bit image. This camera
  12. also has a pixel aspect ratio of 1 to 1.16 which could be corrected by the plug-in, but
  13. since both Image and Photoshop have scaling, I didn't bother for now.  
  14.  
  15. The image is only 192 X 165 pixels, so the entire image is read from the disk and 
  16. stored while it is processed. For very large images the plug-in would probably want to 
  17. read the file one piece at a time and pass it on in like manner. The example in the 
  18. developer's kit documents how to do this. One additional thing to keep in mind is to
  19. be careful not to leave any files open in case of user cancellation. 
  20.  
  21. Experimentally I have tried to allocate huge blocks (4 Meg) of memory from a plug-in
  22. without problem. I have also tried file getting/saveing from all three types of plug-ins. This means some pretty sophisticated things could be managed from the 
  23. plug-in environment.
  24.      
  25. The process goes basicly like this:
  26.  
  27.     1    The calling application enters the plug-in with the DoPrepare() routine
  28.             here you can initialize your globals and allocate your memory. I have 
  29.             allocated a handle big enough to hold the entire image as 16-bit numbers,
  30.             making it simple to later implement rescaling. Also in this case the user is
  31.             prompted for a file and the appropriate information is saved. Remember also, 
  32.             it is important to be able to recover from file errors. A plug-in reading, for 
  33.             instance, a compressed TIFF file might want to build some tables or do other prep 
  34.             here.
  35.  
  36.     2    The DoStart () routine puts up a modal dialog giving the user a chance to control
  37.             the acqusition process. There are many possibilities here. I show the user the
  38.             min and max values and allow them to be changed. Another option would be to 
  39.             plot a histogram and allow selection graphically of the range of values to be 
  40.             converted, possibly with gamma correction. My intention eventually is to have
  41.             the user prompted upon reentry for rescaling of the last image or getting a
  42.             new image. 
  43.  
  44.     3    The image is actually processed by the DoContinue () routine. The paradyme
  45.             here is rows and columns, left to right and top to bottom. Progress is measured in 
  46.             this manner. After each row there is a test for user cancellation and an update     
  47.             of a standard progress thermometer. It is up to the calling application to provide
  48.             these routines. Here the image is scaled to 8-bits of dynamic range and passed 
  49.             on. 
  50.  
  51.     4  A friendly plug-in will release its memory at completion when DoFinish () is
  52.           called. Of course, a command like rescale could be implemented by leaving the
  53.             the image in memory, avoiding the need to read it again.  
  54.         
  55.                 
  56.  
  57.